package daily.may0522;

import java.util.HashMap;
import java.util.LinkedHashMap;

public class LinkedHashMapTest {
    public static void main(String[] args) {
        HashMap<String,String> map = new HashMap<>();
        map.put("张三","王五");
        map.put("李四","赵六");
        map.put("YDD","XHH");
        map.put("张三","田七");
        System.out.println(map);//key不允许重复,无序输出{李四=赵六, 张三=田七, YDD=XHH}

        LinkedHashMap<String,String> linked = new LinkedHashMap<>();
        linked.put("张三","王五");
        linked.put("李四","赵六");
        linked.put("YDD","XHH");
        linked.put("张三","田七");
        System.out.println(linked);//key不允许重复,有序输出{张三=田七, 李四=赵六, YDD=XHH}
    }
}
